<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>收藏页面</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.min.js"></script>
    <script src="/js/plugins/jrender/jrender.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css">
    <link rel="stylesheet" href="/css/reset.css">
    <link rel="stylesheet" href="/css/userProfiles.css">
    <link rel="stylesheet" href="/js/plugins/jquery-confirm/css/jquery-confirm.css">
    <script src="/js/plugins/jquery-confirm/js/jquery-confirm.js"></script>
    <script src="/js/common.js"></script>
    <script>

        $(function () {
            var user=JSON.parse(sessionStorage.getItem("user"));
            //发送请求,查询当前用户所有的收藏日报
            $.get("/users/"+user.id+"/news",function (data) {
                var newsNumber=data.length;
                $("#newsCollectionNumber").html(newsNumber);
                $("#news").renderValues({"list":data},{
                    handle:function (ele,value) {
                        $(ele).attr("href", "/newsContent.html?id=" + value);
                    }
                });
            })


            //发送请求,查询当前用户所有的收藏游记
            $.get("/users/"+user.id+"/travelCollection",function (data) {
                var newsNumber=data.length;
                $("#travelCollectionNumber").html(newsNumber);
                $("#travels").renderValues({"list":data},{
                    handle:function (ele,value) {
                        $(ele).attr("href", "/travelContent.html?id=" + value);
                    }
                });
            })
            //进行渲染


        })
    </script>
</head>
<body>
<!--<div class="container bg" style="background-image: url(&quot;/img/user/bg.jpeg&quot;);">-->
<a href="javascript:window.history.go(-1)" class="my-arrow">
    <span><i class="fa fa-chevron-left fa-2x"></i></span>
</a>
<div class="tabs">
    <ul class="nav nav-pills nav-justified  border border-left-0 border-top-0 border-right-0" id="pills-tab"
        role="tablist">
        <li class="nav-item">
            <a class="nav-link active show" id="new-tab" data-toggle="pill" href="#news">
                头条收藏[<span id="newsCollectionNumber">1</span>]
            </a>
        </li>
        <li class="nav-item">
            <a class="nav-link " id="travels-tab" data-toggle="pill" href="#travels">
                游记收藏[<span id="travelCollectionNumber">1</span>]
            </a>
        </li>
        <li class="nav-item">
            <a class="nav-link" id="comments-tab" data-toggle="pill" href="#comments">
                攻略收藏[<span>0</span>]
            </a>
        </li>
    </ul>
    <div class="container tab-content" id="pills-tabContent">
        <div class="tab-pane fade" id="comments">
            <dl class="list">
                <dd>
                    <a href="travelContent.html" data-id="2">
                        <img src="/upload/6bf2b75d-cc43-44a1-9107-fdf1bbcb4222.png">
                        <p><span class="title" render-html>入住长隆熊猫酒店，天天都是儿童节</span>
                            <span class="span-right">
                               <span>0</span>
                                <i class="fa fa-thumbs-o-up"></i>
                            </span>
                        </p>
                    </a>
                    <hr>
                </dd>
            </dl>
        </div>
        <div class="tab-pane" id="travels">
            <dl class="list"  render-loop="list">
                <dd>
                    <a render-key="list.travel.id" render-fun="handle">
                        <img render-src="list.travel.coverUrl">
                        <p><span render-html="list.travel.title"></span>
                        </p>
                    </a>
                    <hr>
                </dd>
            </dl>
        </div>
        <div class="tab-pane fade show active" id="news" >
            <dl class="list" render-loop="list">
                <dd>
                    <a render-key="list.news.id" render-fun="handle">
                        <img render-src="list.news.coverUrl"/>

                        <p><span class="title" render-html="list.news.title"></span>
                            <span class="span-right">
                            </span>
                        </p>
                    </a>
                    <hr>
                </dd>
            </dl>
        </div>
    </div>
</div>
</body>

</html>